#include <iostream>
#include <vector>
#include <unordered_map>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define endl '\n'
const int N = 2e5 + 10;

int a[N];
unordered_map<int, int> mp;
unordered_map<int, int> ans;

int cala(int x)
{
    int ret = 0;
    for(int i = 1; i * i <= x; i++)
    {
        if(x % i == 0)
        {
            ret += mp[i];
            if(x / i != i) ret += mp[x / i];
        }
    }
    return ret;
}

void solve() 
{
    int n; cin >> n;
    for(int i = 1; i <= n; i++) 
    {
        cin >> a[i];
        mp[a[i]]++;
    }
    for(int i = 1; i <= n; i++)
    {
        if(ans.count(a[i])) cout << ans[a[i]] << endl;
        else cout << (ans[a[i]] = cala(a[i]) - 1) << endl;
    }

}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T = 1;
	// cin >> T;
	while(T--)
	{
        solve();
	}
	return 0;
}